package com.lin.mapper;

import com.lin.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {
    /**
     *   查询全部数据
     *
     * @return
     */
    @Select("select * from user")
    List<User> findAll();



    /**
     *  增加一条数据
     * @param user
     */
    @Insert("insert into user(uname,money) values(#{uname},#{money})")
    void addUser(User user);

    /**
     *   根据id 删除 一条数据
     *
     * @param id
     */
    @Delete("delete from user where id=#{id}")
    void deleteById(int id);

    /**
     *   根据 id 修改数据
     *      *   xml 动态sql
     * @param user
     */
    void updateUser(User user);
}
